package http;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.util.CharsetUtil;


public class RoutePlayer extends gl.java.umsp.websocket.RouteBase implements gl.java.umsp.websocket.IHttpController {

    public RoutePlayer() {

    }

    @Override
    public boolean onHttpRequest(FullHttpRequest request, DefaultFullHttpResponse rsp, ChannelHandlerContext ctx) {
        rsp.setStatus(HttpResponseStatus.NOT_FOUND);
        rsp.headers().set(HttpHeaders.Names.CONTENT_TYPE,
                "text/html");
        ByteBuf responseBuf = Unpooled.copiedBuffer("{}", CharsetUtil.UTF_8);
        rsp.content().writeBytes(responseBuf);
        handKeepLive(request,rsp);
        ctx.writeAndFlush(rsp);
        responseBuf.release();
        return true;
    }
}
